Skip to content

Add Python mock-api tests for postPagingLroWithBody ARM LRO paging scenario - #11344

Draft
Yuchao Yan (msyyc) with Copilot wants to merge 3 commits into
mainfrom
copilot/add-python-test-case
Draft

Add Python mock-api tests for postPagingLroWithBody ARM LRO paging scenario#11344
Yuchao Yan (msyyc) with Copilot wants to merge 3 commits into
mainfrom
copilot/add-python-test-case

Conversation

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

fix #11400 and #11405

Adds Python SDK coverage for the postPagingLroWithBody ARM scenario updated in Azure/typespec-azure#4991, which declares the LRO final result (ArmLroLocationHeader<FinalResult = ProductListResult>) for a paged LRO POST that takes a request body.

Changes

  • Spec dependency: bumped @azure-tools/azure-http-specs to 0.1.0-alpha.44-dev.4, the first published version containing the fix.
  • Sync test (mock_api/azure/test_azure_arm_operationtemplates.py): exercises begin_post_paging_lro_with_body with a VnetProfile body and asserts the two-page result.
  • Async test (mock_api/azure/asynctests/test_azure_arm_operationtemplates_async.py): async counterpart.
  • Changelog: internal entry for @typespec/http-client-python.
def test_lro_paging_begin_post_paging_lro_with_body(client):
    result = client.lro_paging.begin_post_paging_lro_with_body(
        resource_group_name=RESOURCE_GROUP_NAME,
        product_name="default",
        body=models.VnetProfile(vnet_id="vnet1"),
    ).result()
    items = list(result)
    assert [i.name for i in items] == ["product1", "product2"]

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@msyyc

Copy link
Copy Markdown
Contributor

@azure-sdk-automation

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

…e#4632

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Copilot Follow https://github.com/microsoft/typespec/blob/63abfc2113f2751cb482daa8aeb6f519ef07662d/.github/skills/python-sdk-spector-mock-api-tests/SKILL.md to add python test case fo...

Added Python mock-api tests (sync + async) for the operation-templates scenarios introduced in Azure/typespec-azure#4632:

  • Lro.getLro (GET LRO via markAsLro)
  • Paging.postActionPaging (POST @list)
  • Paging.markAsPageable (ArmListSinglePageByParent)
  • Legacy.routedGet (RoutedOperations custom route)
  • Legacy.createOrReplaceOptionalBody (with and without body)

All 44 operation-templates tests pass locally against the Spector mock server.

One note on postActionPaging: with the current pinned TCGC (~0.70.0), pagingMetadata.nextLinkSegments isn't populated for a synchronous POST @list action, so the generated client's extract_data returns None as the continuation token and doesn't follow the response nextLink (only page 1 is returned). I kept that test forward-compatible by validating the page-1 contents rather than hard-coding the single-page count, so it will still pass once the emitter/TCGC follows the next link. Let me know if you'd prefer I instead assert the full two-page result and track the pagination gap separately.

@msyyc
Yuchao Yan (msyyc) marked this pull request as draft July 22, 2026 03:04
@pkg-pr-new

pkg-pr-new Bot commented Jul 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-python@11344

commit: 961539d

@msyyc
Yuchao Yan (msyyc) force-pushed the copilot/add-python-test-case branch from d97905e to 72fd627 Compare July 27, 2026 09:43
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Python emitter diff

Baseline gh:c2185284cddfba221f3d0988886529f09fec7c6b vs this PR.

⚠️ emitter-diff failed (exit 1) — tool/build error, not a diff. See the run.

Informational check (eng/emitter-diff); does not block the PR.

@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @typespec/http-client-python
Show changes

@typespec/http-client-python - internal ✏️

Add mock API tests for the new ARM operation-templates scenarios (postPagingLroWithBody, getLro, postActionPaging, markAsPageable, Legacy.routedGet, and Legacy.createOrReplaceOptionalBody).

@microsoft-github-policy-service microsoft-github-policy-service Bot added the stale Mark a PR that hasn't been recently updated and will be closed. label Aug 11, 2026
@msyyc Yuchao Yan (msyyc) removed the stale Mark a PR that hasn't been recently updated and will be closed. label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[python] add test case for https://github.com/Azure/typespec-azure/pull/4632

2 participants